//
//  UIButton+Extension.swift
//  WBDemo
//
//  Created by Jin on 17/04/2018.
//  Copyright © 2018 com.baidu.123. All rights reserved.
//

import UIKit

extension UIButton {
    convenience init(imageName:String,backgroundImageName:String) {
        self.init()
        
        //设置前景及背景
        setImage(UIImage(named: imageName), for: UIControlState.normal)
        setImage(UIImage(named: imageName + "_highlighted"), for: UIControlState.highlighted)
        setBackgroundImage(UIImage(named: backgroundImageName), for: UIControlState.normal)
        setBackgroundImage(UIImage(named: backgroundImageName + "_highlighted"), for: UIControlState.highlighted)

        sizeToFit()
    }
}
